import Http from "@/http"
import { dictionaryItemByCategoryApi } from "./Dictionary"
export function saveApi(params:any) {
    return params.id ? Http.put('menu/update/' + params.id, params) : Http.post('menu/add', params)
}

export function listApi() {
    return Http.get('menu/list')
}

export function deleteApi(id) {
    return Http.delete('menu/delete/' + id)
}

export async function menuTypeApi() {
    const { data } = await dictionaryItemByCategoryApi('MENU_TYPE')
    return data
}

export async function apiMethodTypeApi() {
    const { data } = await dictionaryItemByCategoryApi('REQUEST_METHOD')
    return data
}

export function permissionMenusApi() {
    return Http.get('menu/permission')
}